****Analyses for Party Unity Perceptions Paper Submission 

*Date: 4/28/2016

***Analyis 1 - 2014 CCES Module 

*Dataset: CCES14Stacked.dta

*Table 1 - Model 1 
mixed perceivedunity c.punity_113 i.ptyagree knowall i.elect3 ///
i.gender i.educ inc inc_dk age ///
i.treat pidstrength [pw=weight] || senname: || id: 
margins, predict() at(ptyagree=(0(1)2)) 

*Table 1 - Model 2 
mixed perceivedunity c.punity_113 i.ptyagree##c.knowall i.ptyagree##i.elect3 ///
i.gender i.educ inc inc_dk age ///
i.treat pidstrength [pw=weight] || senname: || id:

margins, predict() at(knowall=(0(1)10) elect3=0 ptyagree=(0(1)1) gender=1 educ=5 inc_dk=0 treat=3)
marginsplot, recastci(rarea) recast(line) ///
	plot2opts(col(gray) fcol(gs10)) ///
	plot1opts(col(black)) ///
	ci1opts(col(gs10)) ///
	ci2opts(col(gs3)) ///
	title("Political Knowledge", size(huge)) ///
	xlabel(0(1)10, labsize(medium))  xtitle("Level of Knowledge") ///
	ylabel(60(5)95, labsize(medium)) ytitle("") ///
	legend(order(3 "Opposition Partisan" 4 "Co-Partisan") rows(1) holes(1 2))

margins, predict() at(elect3=(0(1)2) ptyagree=(0(1)1) gender=1 educ=5 inc_dk=0 treat=3) 
marginsplot, recast(scatter) ///
	ci1opts(col(black) fcol(gs10)) ///
	ci2opts(lpattern("-") col(gray) fcol(gs10)) ///
	title("Election", size(huge)) ///
	xlabel(0 "No Election" 1 "Safe" 2 "Competitive",angle(0) labsize(medium))  xtitle("Electoral Status") ///
	ylabel(75(5)90, labsize(medium)) ytitle("") ///
	legend(off)


**Linear Combination Tests for electoral effects 

*Co-Partisans 
lincom ((2.elect3+1.ptyagree+2.elect3#1.ptyagree))-((1.elect3+1.ptyagree+1.elect3#1.ptyagree))
lincom ((1.elect3+1.ptyagree+1.elect3#1.ptyagree))-((0.elect3+1.ptyagree+0.elect3#1.ptyagree))
lincom ((2.elect3+1.ptyagree+2.elect3#1.ptyagree))-((0.elect3+1.ptyagree+0.elect3#1.ptyagree))
*Opposition Partisans 
lincom ((2.elect3+0.ptyagree+2.elect3#0.ptyagree))-((1.elect3+0.ptyagree+1.elect3#0.ptyagree))
lincom ((1.elect3+0.ptyagree+1.elect3#0.ptyagree))-((0.elect3+0.ptyagree+0.elect3#0.ptyagree))
lincom ((2.elect3+0.ptyagree+2.elect3#0.ptyagree))-((0.elect3+0.ptyagree+0.elect3#0.ptyagree))

margins, dydx(ptyagree) at(elect3=(0(1)2) gender=1 educ=5 inc_dk=0 treat=3) 




